package org.dizem.groupon.action;

import com.opensymphony.xwork2.ActionSupport;
import org.dizem.groupon.model.domain.ItemEntity;
import org.dizem.groupon.service.ItemService;

import java.io.File;

/**
 * User: dizem@126.com
 * Time: 11-6-28 下午12:56
 */
public class AddItemAction extends ActionSupport {
	private ItemEntity item;
	private ItemService itemService;
	private File[] upload;
	private String[] uploadContentType;
	private String[] uploadFileName;
	private String cityName;
	private String merchantName;
	private String categoryName;
	private String message;

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public String getMerchantName() {
		return merchantName;
	}

	public void setMerchantName(String merchantName) {
		this.merchantName = merchantName;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public ItemEntity getItem() {
		return item;
	}

	public void setItem(ItemEntity item) {
		this.item = item;
	}

	public ItemService getItemService() {
		return itemService;
	}

	public void setItemService(ItemService itemService) {
		this.itemService = itemService;
	}

	public File[] getUpload() {
		return upload;
	}

	public void setUpload(File[] upload) {
		this.upload = upload;
	}

	public String[] getUploadContentType() {
		return uploadContentType;
	}

	public void setUploadContentType(String[] uploadContentType) {
		this.uploadContentType = uploadContentType;
	}

	public String[] getUploadFileName() {
		return uploadFileName;
	}

	public void setUploadFileName(String[] uploadFileName) {
		this.uploadFileName = uploadFileName;
	}

	@Override
	public String execute() throws Exception {
		itemService.save(item, upload, categoryName, merchantName, cityName);
		message = "add Success";
		return SUCCESS;
	}
}
